﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using EQT.Dal;
using System.Threading;
using EQT.Model;

public partial class UsersNotice : System.Web.UI.Page
{
    private DaNotice dalNotice = new DaNotice();
    private UserContext context;

    protected void Page_Load(object sender, EventArgs e)
    {
        context = Session["USER_CONTEXT"] as UserContext;
        OperationResult.Text = "";
        divResult.Visible = false;
        AspNetPager.PageSize = 15;

        if (!IsPostBack)
        {
            this.QueryNotice();
        }
    }

    private void QueryNotice()
    {
        int pagecount = 0;

        this.Repeater.DataSource = dalNotice.GetMyNoticeRecords(context.UserID, null, AspNetPager.PageSize, AspNetPager.CurrentPageIndex - 1, out pagecount);

        Repeater.DataBind();

        AspNetPager.RecordCount = pagecount;

    }

    protected void AspNetPager_PageChanged(object sender, EventArgs e)
    {
        this.QueryNotice();
    }

    public string Substring(string strContent)
    {
        return strContent.Length > 50 ? strContent.Substring(0, 50) + "..." : strContent;
    }
}
